/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EC;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author TrangNHIT
 */
@Entity
@Table(name = "tbSaleOff")
@NamedQueries({
    @NamedQuery(name = "SaleOff.findAll", query = "SELECT s FROM SaleOff s"),
    @NamedQuery(name = "SaleOff.findBySaleOffID", query = "SELECT s FROM SaleOff s WHERE s.saleOffID = :saleOffID"),
    @NamedQuery(name = "SaleOff.findBySaleOffPromotion", query = "SELECT s FROM SaleOff s WHERE s.saleOffPromotion = :saleOffPromotion"),
    @NamedQuery(name = "SaleOff.findBySaleOffBegin", query = "SELECT s FROM SaleOff s WHERE s.saleOffBegin = :saleOffBegin"),
    @NamedQuery(name = "SaleOff.findBySaleOffEnd", query = "SELECT s FROM SaleOff s WHERE s.saleOffEnd = :saleOffEnd")})
public class SaleOff implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "SaleOff_ID")
    private Integer saleOffID;
    @Basic(optional = false)
    @Column(name = "SaleOff_Promotion")
    private double saleOffPromotion;
    @Basic(optional = false)
    @Column(name = "SaleOff_Begin")
    @Temporal(TemporalType.TIMESTAMP)
    private Date saleOffBegin;
    @Basic(optional = false)
    @Column(name = "SaleOff_End")
    @Temporal(TemporalType.TIMESTAMP)
    private Date saleOffEnd;
    @JoinColumn(name = "Pro_ID", referencedColumnName = "Pro_ID")
    @ManyToOne(optional = false)
    private Products products;

    public SaleOff() {
    }

    public SaleOff(Integer saleOffID) {
        this.saleOffID = saleOffID;
    }

    public SaleOff(Integer saleOffID, double saleOffPromotion, Date saleOffBegin, Date saleOffEnd) {
        this.saleOffID = saleOffID;
        this.saleOffPromotion = saleOffPromotion;
        this.saleOffBegin = saleOffBegin;
        this.saleOffEnd = saleOffEnd;
    }

    public Integer getSaleOffID() {
        return saleOffID;
    }

    public void setSaleOffID(Integer saleOffID) {
        this.saleOffID = saleOffID;
    }

    public double getSaleOffPromotion() {
        return saleOffPromotion;
    }

    public void setSaleOffPromotion(double saleOffPromotion) {
        this.saleOffPromotion = saleOffPromotion;
    }

    public Date getSaleOffBegin() {
        return saleOffBegin;
    }

    public void setSaleOffBegin(Date saleOffBegin) {
        this.saleOffBegin = saleOffBegin;
    }

    public Date getSaleOffEnd() {
        return saleOffEnd;
    }

    public void setSaleOffEnd(Date saleOffEnd) {
        this.saleOffEnd = saleOffEnd;
    }

    public Products getProducts() {
        return products;
    }

    public void setProducts(Products products) {
        this.products = products;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (saleOffID != null ? saleOffID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SaleOff)) {
            return false;
        }
        SaleOff other = (SaleOff) object;
        if ((this.saleOffID == null && other.saleOffID != null) || (this.saleOffID != null && !this.saleOffID.equals(other.saleOffID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EC.SaleOff[saleOffID=" + saleOffID + "]";
    }

}
